* RANDOMIZATION INFERENCE
	* 
	local q = 1
	foreach var of varlist $nothreatvars  {
		if "`var'" == "nothreat_cycle1_true" {
			local xname = "Effect of Window 1 No-Threat"
			} 
		else if "`var'" == "nothreat_cycle2" {
			local xname = "Effect of Window 2 No-Threat"
			}
		else if "`var'" == "nothreat_cycle3" {
			local xname = "Effect of Window 3 No-Threat"
			}
		else if "`var'" == "posttest_ntc4" {
			local xname = "Effect of Placebo"
			}
		else {
			local xname = "`var'"
			}
		
		if $ricluster == 1 {
			if $multipletreats == 1 {
				** define treat2 treat3 treat4
				if "`var'" == "nothreat_cycle1_true"{
					if "$haz_var_indicator" == "kernel"{
						local treat2 haz_m1_true
						}
					else if "$haz_var_indicator" == "uniform" {
						local treat2 haz_unif_m1
						}
					*local treat3 postconf_p1 
					*local treat4 postconf_m1
				
					
					noisily: ritest `var' _b[`var'], force ///
						samplingprogram(permute_tied_clustered_2treat) ///
						samplingprogramoptions("class(_id_year) treat1(`var') treat2(`treat2')") ///
						seed($rand_seed) reps($reps) kdensityplot kdensityoptions("title(`xname')" "xtitle(Coefficient Size)") : $my_cmd
				}
				else if "`var'" == "nothreat_cycle3"{
					
					if "$haz_var_indicator" == "kernel"{
						local treat2 haz_m2
						local treat3 haz_p2
						}
					else if "$haz_var_indicator" == "uniform" {
						local treat2 haz_unif_m2
						local treat3 haz_unif_p2
						}
					*local treat4 postconf_m2
					*local treat5 postconf_p2
					noisily: ritest `var' _b[`var'], force ///
						samplingprogram(permute_tied_clustered_3treat) ///
						samplingprogramoptions("class(_id_year) treat1(`var') treat2(`treat2') treat3(`treat3')") ///
						seed($rand_seed) reps($reps) kdensityplot kdensityoptions("title(`xname')" "xtitle(Coefficient Size)") : $my_cmd
				}
			}
			else {
				if "`var'" == "nothreat_cycle1_true"{
					if "$haz_var_indicator" == "kernel"{
						local treat2 haz_m1_true
						}
					else if "$haz_var_indicator" == "uniform" {
						local treat2 haz_unif_m1
						}
					local treat3 postconf_p1 
					local treat4 postconf_m1
					
					noisily: ritest `var' _b[`var'], force ///
						samplingprogram(permute_tied_clustered_4treat) ///
						samplingprogramoptions("class(_id_year) treat1(`var') treat2(`treat2') treat3(`treat3') treat4(`treat4')") ///
						seed($rand_seed) reps($reps) kdensityplot kdensityoptions("title(`xname')" "xtitle(Coefficient Size)") : $my_cmd
				}
				else {
					noisily: ritest `var' _b[`var'], force seed($rand_seed) reps($reps) cluster(_id_year) kdensityplot kdensityoptions("title(`xname')" "xtitle(Coefficient Size)"): $my_cmd
				}
			}
		}
		else if $ricluster == 0{
			noisily: ritest `var' _b[`var'], force seed($rand_seed) reps($reps) kdensityplot kdensityoptions("title(`xname')" "xtitle(Coefficient Size)"): $my_cmd
		}
			
		graph export "$output_dir\Figures\_Figure${tablenum}_`var'_${outcomename}_m${my_num}.png", replace
		di `q'
		matrix temp=r(ci)
		matrix t2 = r(p)
		matrix colnames temp = `var'
		matrix colnames t2 = `var'
		if `q' == 1 {
			matrix pci = temp
			matrix pvalues = t2
		}
		else if `q' > 1 {
			matrix pci = pci,temp
			matrix pvalues = pvalues,t2
		}
		local q = `q' + 1
	}
	
	estimates restore model$my_num
	estadd matrix LB = pci[1,1...]
	estadd matrix UB = pci[2,1...]
	estadd matrix pvalues = pvalues
	
	
	